package com.zjol

import scala.io.Source

/**
  * Created by Administrator on 2017/3/27.
  */
object forFuction2 {



  def  addA(x:Int) =x+10

  def  add=(x:Int)=>x+10

  def fac(n:Int):Int={
    if(n<=1)
      return 1
    else
      return fac(n-1)+fac(n-2)
  }

  def  sum(args:Int*)={
    var result=0
    for (arg<-args){
      result+=arg
    }
    result
  }


  def main(args: Array[String]): Unit = {


    println(addA(1))
    println(add(1))
    println(fac(10))
    println(sum(1,2,3,4,5))


     // for (i<- 1 to 10;j<-1 to 10 ) println(i+" "+j)

    //  for(i<- 1 to 10 ;j<- 1 to 10 if i!=j) println(i+" "+j)

    lazy val baidu=Source.fromURL("http://www.baidu.com")
    println(baidu)


  }

}
